blog-16.dustise sleep 測試工具簡介

前言

之前就有用過 dustise/sleep ,用for 迴圈來打 網址做測試,
今天想說那裡面的http到底是哪一套工具,才發現原來裡面有那麼多的工具能用。
2021.03.18更新:又找到了幾款不錯用的工具,同步增加

正文

裡面的工具列表,可以參考他的git
然後我們看到他的dockerfile,裡面有
bind-tools curl wrk vim
tcptraceroute iptables httpie bash
tini apache2-utils stress-ng strace
這次會抓幾個記錄一下

  1. bind-tools
    安裝nslookup用,可查詢域名

nslookup tw.yahho.com
2. curl
取得網頁資料
curl ifconfig.me
參數很多,通常會使用postman將要截取的資料轉成curl,再到command做測試。
如果只是要簡單測試,可以加上 -v 看詳細內容
3. wrk
模擬多人來網站時的效能,有點像壓力測試工具。

  wrk -t12 -c400 -d30s -T30s --latency http://localhost/productpage
  # -t12 用 12 個線程
  # -c400 模擬 400 個併發連接
  # -d30s 持續 30 秒
  # -T30s 設定超過 30 秒就算連接超時
  # --latency 響應時間的分佈情況

[16.fig-1.jpg

更詳細的說明,請參考:HTTP Benchmark 工具 Wrk

  1. vim
    文字編輯器,就不介紹了。

  2. tcptraceroute
    路由追蹤器,追蹤網路死在哪一層

  traceroute tw.yahoo.com
  1. iptables
    路由表

  2. httpie
    之前使用
    for i in seq 20;do http --body http://ipaddress/api/v1/Health/health; done;
    打網址的指令。
    httpie 是一個 HTTP 的命令行客戶端。其目標是讓 CLI 和 web 服務之間的交互儘可能的人性化。
    想用來取代wget ,curl 等功能,然後畫面比較美觀,如果回來的是json,那差異會更大。

[[16.fig-2.jpg]]

下載
http --download example.org/file
只看header
http -h http://ipaddress/productpage

ref.
HTTPie:超爽的HTTP命令行客戶端
HTTPie 官方文檔中文翻譯版


同場加註

jid
https://github.com/simeji/jid
jq
https://stedolan.github.io/jq/manual/#Basicfilters

hey
https://github.com/rakyll/hey

e.g. 加上 method ,content/type ,dataraw

hey -z 3m -q 10 -c 3 -m POST -T 'application/json' -d '{ "method": "GetUrlForWard",  "host": "landing500023.com"}' https://landing500023.com/query.php